import { INewsInfo } from '@/typings';

/**
 * 该函数从localStorage中获取收藏的新闻信息
 * @returns 收藏的新闻信息
 */
function useFollowedList(): INewsInfo[] | null {
  const followedList: INewsInfo[] = JSON.parse(
    localStorage.getItem('newsList') || '[]'
  );

  //没有收藏内容时
  if (!followedList.length) {
    return null;
  }

  return followedList;
}

export { useFollowedList };
